# Maintainer: Christian Rebischke <chris.rebischke@archlinux.org>
pkgname=rosenpass
pkgver=0.2.0
pkgrel=2
pkgdesc="formally verified and post-quantum secure VPN over WireGuard"
url="https://rosenpass.eu"
arch=('loong64' 'x86_64')
license=(MIT APACHE)
makedepends=('cargo' 'git' 'cmake' 'pkg-config' 'rust-bindgen')
depends=('libsodium' 'gawk' 'wireguard-tools' 'findutils')
provides=('rp' 'rosenpass')
source=("${pkgname}-${pkgver}::https://github.com/rosenpass/rosenpass/archive/refs/tags/v${pkgver}.tar.gz")
sha512sums=('1ca219989edaaf7df77da0fcf5ab03deff047db03d6d49a0cc50c0342141770c14b3a9815bac1d7d263d1868113c3847b9142333fa568740d696e8b1fa81954c')
b2sums=('857bd2543d08387f7fcc3408ab0faf9430e53a9ae0903e01ac75f164b929b0507bb1069ddcb0f17b7ecd4302193b0eb1cee9eaaa0234fe164e80b1be480fd047')
options=(!lto)

_bin=rosenpass
_script=rp

prepare() {
    cd "${pkgname}-${pkgver}"
    cargo fetch --locked --target $CARCH-unknown-linux-gnu
}

build() {
    cd "${pkgname}-${pkgver}"
    cargo build --release --frozen
}

#check() {
#    cd "${pkgname}-${pkgver}"
#    cargo test --frozen
#}

package() {
    cd "${pkgname}-${pkgver}"
    install -Dm 0755 "target/release/${_bin}" "${pkgdir}/usr/bin/${_bin}"
    install -Dm 0755 "${_script}" "${pkgdir}/usr/bin/${_script}"
    install -Dm 0644 LICENSE-MIT "${pkgdir}/usr/share/licenses/${_pkgname}/LICENSE-MIT"
    install -Dm 0644 LICENSE-APACHE "${pkgdir}/usr/share/licenses/${_pkgname}/LICENSE-APACHE"
}
